<div class="tabbable tabs-left">
              <ul class="nav nav-tabs">
              	<li><h5><?php echo $this->translate('导航链接'); ?></h5></li>
                <li class="active"><a data-toggle="tab" href="#express_a"><?php echo $this->translate('基本信息'); ?></a></li>
              </ul>
              <form class="form-horizontal" name="navigation_form" id="navigation_form" method="post" action="">
              <div class="tab-content">
    			<div id="sticky_navigation" style="height:30px;border-bottom:4px solid #DFDFDF;">
        			<div class="pull-left" style="font-size:16px;line-height:30px;"><strong><?php if($this->navigation_info) echo $this->translate('编辑'); else echo $this->translate('新加'); ?><?php echo $this->translate('导航链接'); ?></strong></div>
        			<div class="pull-right">
                	<a href="<?php echo $this->url('navigation/default'); ?>" class="btn btn-small"><i class="icon-arrow-left"></i> <?php echo $this->translate('返回导航链接列表'); ?></a>&nbsp;
                	<a href="<?php echo $this->serverUrl(true); ?>" class="btn btn-small btn-warning"><i class="icon-repeat icon-white"></i> <?php echo $this->translate('刷新'); ?></a>&nbsp;
                    <?php if($this->navigation_info) { ?>
                    <a href="javascript:;" onclick="return navigation_del_js(<?php echo $this->navigation_info->navigation_id ?>);" class="btn btn-small btn-danger"><i class="icon-remove icon-white"></i> <?php echo $this->translate('删除导航链接'); ?></a>&nbsp;
                    <?php } ?>
                	<button type="submit" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存导航链接信息'); ?></button>&nbsp;
                	<a href="<?php echo $this->myviewalias()->dbshopHelpUrl('navigation_set'); ?>" target="_blank" class="btn btn-small btn-info"><i class="icon-info-sign icon-white"></i> <?php echo $this->translate('查看帮助说明'); ?></a>
                	</div>
        		</div>
                <div id="express_a" class="tab-pane active">
                	<div class="well admin_add_header_well"><?php echo $this->translate('基本信息'); ?></div>
                	<div class="well admin_add_well"> 
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('导航标题'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<input type="text" id="navigation_title"  name="navigation_title" class="span8" value="<?php echo ($this->navigation_info ? $this->escapeHtml($this->navigation_info->navigation_title) : ''); ?>">
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('链接地址'); ?>：</label>
           					<div class="controls">
              					<input type="text" id="navigation_url"  name="navigation_url" placeholder="<?php echo $this->translate('外网地址请自行加入 http:// 或 https://  [ 如: http://www.baidu.com ]'); ?>" class="span8" value="<?php echo ($this->navigation_info ? $this->navigation_info->navigation_url : ''); ?>">
                                <button class="btn btn-small btn-primary" type="button" onclick="add_brand_url_js();"><?php echo $this->translate('获取商品品牌地址'); ?></button>
            				</div>                        
                        </div>
						<div class="control-group">
							<label for="input01" class="control-label"><?php echo $this->translate('导航位置'); ?>：</label>
							<div class="controls">
								<select name="navigation_type" id="navigation_type" class="span2">
									<option value="1" <?php if ($this->navigation_info and $this->navigation_info->navigation_type==1) echo 'selected="selected"'; ?>><?php echo $this->translate('顶部'); ?></option>
									<option value="2" <?php if ($this->navigation_info and $this->navigation_info->navigation_type==2) echo 'selected="selected"'; ?>><?php echo $this->translate('中部'); ?></option>
									<option value="3" <?php if ($this->navigation_info and $this->navigation_info->navigation_type==3) echo 'selected="selected"'; ?>><?php echo $this->translate('底部'); ?></option>
								</select>
							</div>
						</div>
						<div class="control-group goods_class">
							<label for="input01" class="control-label"><?php echo $this->translate('商品分类'); ?>：</label>
							<div class="controls">
								<select name="goods_class_id" id="goods_class_id" onchange="select_goods_class();" class="span3">
									<option value="0"><?php echo $this->translate('选择商品分类'); ?></option>
									<?php
									if ($this->goods_class) {
										foreach ($this->goods_class as $class_val) {
											?>
											<option value="<?php echo $class_val['class_id'] ?>" <?php if(($this->navigation_info and $this->navigation_info->goods_class_id == $class_val['class_id'])) { ?>selected="selected"<?php } ?>><?php echo str_repeat('&nbsp;', $class_val['class_level'] * 5).$class_val['class_name']; ?></option>
											<?php
										}
									}
									?>
								</select>
								<i class="cus-help shop_admin_help_note" data-content="<?php echo $this->translate('当导航位置是 中部，同时选择的分类有下级分类，前台模板如果支持显示二级分类，将自行显示二级分类。'); ?>"></i>
							</div>
						</div>
						<div class="control-group">
							<label for="input01" class="control-label"><?php echo $this->translate('新窗口打开'); ?>：</label>
							<div class="controls">
								<label class="radio inline"><input type="radio" value="1" <?php if(($this->navigation_info and $this->navigation_info->navigation_new_window == 1) or !$this->navigation_info) echo 'checked="checked"'; ?> name="navigation_new_window"><?php echo $this->translate('是'); ?></label>
								<label class="radio inline"><input type="radio" value="0" <?php if($this->navigation_info and $this->navigation_info->navigation_new_window == 0) echo 'checked="checked"'; ?> name="navigation_new_window"><?php echo $this->translate('否'); ?></label>
							</div>
						</div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('排序'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<input type="text" class="span1" name="navigation_sort" id="navigation_sort" value="<?php echo ($this->navigation_info ? $this->navigation_info->navigation_sort : 255); ?>" />
            				</div>                        
                        </div>                                                                                                                                               
                  	</div>
                </div>
                                
                
             </div>
              </form>
</div>
<script>
$(document).ready(function() {
	$("#navigation_form").validate({
		rules: {
			navigation_title: {
				required: true,
				maxlength:60
			},
			navigation_sort: {
				required: true,
				number: true,
				min:1,
				max:255
			}
		},
		messages: {
			navigation_title: {
				required: "<?php echo $this->translate('导航链接名称不能为空！'); ?>",
				maxlength: "<?php echo $this->translate('导航链接名称最多输入60个汉字！'); ?>"
			},
			navigation_sort: {
				required: "<?php echo $this->translate('导航链接排序不能为空！'); ?>",
				number: "<?php echo $this->translate('导航链接排序必须为数字！'); ?>",
				min: "<?php echo $this->translate('导航链接排序最小为1！'); ?>",
				max: "<?php echo $this->translate('导航链接排序最大为255！'); ?>"
			}
		}
	});
});

//导航删除js
function navigation_del_js(navigation_id) {
	if(window.confirm('<?php echo $this->translate('您确实要删除该导航吗？'); ?>')) {
	$.post("<?php echo $this->url('navigation/default',array('action'=>'del')); ?>",{navigation_id:navigation_id},
	function(data){
		if(data != 'false') {
			window.location.href='<?php echo $this->url('navigation/default'); ?>';
			return true;
		} else {
			alert('<?php echo $this->translate('导航删除失败！'); ?>');
		}
	});
	}
	return false;
}
//添加品牌url
function add_brand_url_js() {
    $('#navigation_url').val('');
    $('#navigation_url').val('<?php echo $this->url('frontbrand/default'); ?>');
}

function select_goods_class() {
	var class_id   = $('#goods_class_id').val();
	var class_name = $("#goods_class_id").find("option:selected").text();
	var class_url  = '<?php echo $this->url('shopfront/default'); ?>list/'+class_id;

	$('#navigation_title').val($.trim(class_name));
	$('#navigation_url').val(class_url);
}

</script>